package com.example.fence.modelTest;

import com.example.fence.util.FenceStoreUtil;

import java.lang.reflect.Array;
import java.util.*;

import static com.example.fence.util.FenceStoreUtil.imeiToPointList;

public class FenceStoreUtilTest {
    public static void main(String[] args){

        List<List<Double>> path=new LinkedList<>();
        List<Double> p1=new LinkedList<>();
        p1.add(120.158917);
        p1.add(30.29928);
        List<Double> p2=new LinkedList<>();
        p2.add(120.142438);
        p2.add(30.280603);
        path.add(p1);
        path.add(p2);

        // 创建时写的表
        List<String> pointList=new LinkedList<>();
        for(List<Double> point:path){
            String pointStr=point.get(0).toString()+","+point.get(1).toString();
            pointList.add(pointStr);
        }
        for(String point:pointList){
            System.out.println(point);
        }
        System.out.println(pointList.size());
        System.out.println(pointList.toString());

        // 发到数据库的信息
        Map<String, String> map = new HashMap<>();
        map.put("fence", "N"+pointList);
        System.out.println(map.get("fence"));

        // 从数据库里读到表中的结果
        String fenceValue=map.get("fence");
        fenceValue = fenceValue.substring(2, fenceValue.length() - 1).replace(" ","");
        pointList= Arrays.asList(fenceValue);
        for(String point:pointList){
            System.out.println(point);
        }
        System.out.println(pointList.size());




    }
}
